package com.xfsg.core.operationlog.support;


import com.xfsg.core.operationlog.annotation.EnableOperationLogRecord;
import com.xfsg.core.operationlog.configuration.OperationLogRecordProxyAutoConfiguration;
import org.springframework.context.annotation.AdviceMode;
import org.springframework.context.annotation.AdviceModeImportSelector;
import org.springframework.lang.Nullable;

/**
 * @Classname LogRecordConfigureSelector
 * @Description TODO
 * @date 2022/1/19 20:39
 * @author ZhangYi
 */
public class LogRecordConfigureSelector extends AdviceModeImportSelector<EnableOperationLogRecord> {
    private static final String ASYNC_EXECUTION_ASPECT_CONFIGURATION_CLASS_NAME =
            "com.xfsg.core.operationlog.configuration.LogRecordProxyAutoConfiguration";


    @Override
    @Nullable
    public String[] selectImports(AdviceMode adviceMode) {
        switch (adviceMode) {
            case PROXY:
                return new String[]{OperationLogRecordProxyAutoConfiguration.class.getName()};
            case ASPECTJ:
                return new String[]{ASYNC_EXECUTION_ASPECT_CONFIGURATION_CLASS_NAME};
            default:
                return null;
        }
    }
}